<!DOCTYPE html>
<html class="no-js" lang="">

<head>
    #include( "/public-head.html")
</head>

<body style="background-color: #ffffff !important;">
<!-- main area -->
<div class="main-content checkbo">
    <div class="panel mb25">
        <div class="panel-heading border">
                       添加用户
        </div>
        <div class="panel-body">
            <div class="row no-margin">
                <div class="col-lg-12">
                    <form action="/vrs/user/edit.jsn" data-url="/vrs/user/list.jsn" id="userForm" name="ajaxForm" class="form-horizontal bordered-group" role="form">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">登录名</label>
                            <div class="col-sm-10">
                                <input type="text" id="uniqueId" required name="user.userName" value="$!{user.userName}" class="form-control w150" placeholder="登录名">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">用户名</label>
                            <div class="col-sm-10">
                                <input type="text" required name="user.fullName" value="$!{user.fullName}" class="form-control w150" placeholder="用户名">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">邮箱</label>
                            <div class="col-sm-10">
                                <input type="email" required name="user.email" value="$!{user.email}" class="form-control w150" placeholder="邮箱">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">密码</label>
                            <div class="col-sm-10">
                                <input type="password" required minlength="6" id ="passwordfield" name="user.passWd"  value="$!{user.passWd}" class="form-control w150" placeholder="密码">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">确认密码</label>
                            <div class="col-sm-10">
                                <input type="password" required minlength="6"  equalTo="#passwordfield"  value="$!{user.passWd}" class="form-control w150" placeholder="确认密码">
                            </div>
                        </div>
                        <div class="form-group">
                            <label></label>
                            <div>
                                <button type="button" onclick="submitUserForm()" class="btn btn-primary mr10">添加</button>
                                <button class="btn btn-default">返回</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>


</div>
<!-- /main area -->

#include( "/public-script.html")
#include( "/sub-script.html")
<script>
$(function(){
  $('#userForm').validate({//出错时添加的标签
		 /*  rules: {
	        	uniqueId: {
	                remote: {
	                    type: "post",
	                    url: "vrs/user/checkusername.html",
	                    data: {
	                        username: function() {
	                            return $("#uniqueId").val();
	                        }
	                    },
	                    dataType: "json",
	                    dataFilter: function(data, type) {
	                        if (data.success == true){
	                            return true;
	                        }
	                        else{
	                            return false;
	                        }
	                    }
	                }
	            }
	        }, */
	        messages: {
	        	uniqueId: {
	        		required: "用户名已存在"
	            }
	        }
  });
});  
  function submitUserForm () {
    if (!$('#userForm').valid()) {
      	return false;
    }else{
    	 $('#userForm').submit();
    }
     
  }
</script>
</body>

</html>
